import request from '@/utils/request'

// 供应商管理
export function listSupplier(query) {
  return request({
    url: '/wms/supplier/list',
    method: 'get',
    params: query
  })
}

export function getSupplier(id) {
  return request({
    url: '/wms/supplier/' + id,
    method: 'get'
  })
}

export function addSupplier(data) {
  return request({
    url: '/wms/supplier',
    method: 'post',
    data: data
  })
}

export function updateSupplier(data) {
  return request({
    url: '/wms/supplier',
    method: 'put',
    data: data
  })
}

export function deleteSupplier(id) {
  return request({
    url: '/wms/supplier/' + id,
    method: 'delete'
  })
}

// 客户管理
export function listCustomer(query) {
  return request({
    url: '/wms/customer/list',
    method: 'get',
    params: query
  })
}

export function getCustomer(id) {
  return request({
    url: '/wms/customer/' + id,
    method: 'get'
  })
}

export function addCustomer(data) {
  return request({
    url: '/wms/customer',
    method: 'post',
    data: data
  })
}

export function updateCustomer(data) {
  return request({
    url: '/wms/customer',
    method: 'put',
    data: data
  })
}

export function deleteCustomer(id) {
  return request({
    url: '/wms/customer/' + id,
    method: 'delete'
  })
}

// 区域管理
export function listArea(query) {
  return request({
    url: '/wms/area/list',
    method: 'get',
    params: query
  })
}

export function getArea(id) {
  return request({
    url: '/wms/area/' + id,
    method: 'get'
  })
}

export function addArea(data) {
  return request({
    url: '/wms/area',
    method: 'post',
    data: data
  })
}

export function updateArea(data) {
  return request({
    url: '/wms/area',
    method: 'put',
    data: data
  })
}

export function deleteArea(id) {
  return request({
    url: '/wms/area/' + id,
    method: 'delete'
  })
}

// 仓库管理
export function listWarehouse(query) {
  return request({
    url: '/wms/warehouse/list',
    method: 'get',
    params: query
  })
}

export function getWarehouse(id) {
  return request({
    url: '/wms/warehouse/' + id,
    method: 'get'
  })
}

export function addWarehouse(data) {
  return request({
    url: '/wms/warehouse',
    method: 'post',
    data: data
  })
}

export function updateWarehouse(data) {
  return request({
    url: '/wms/warehouse',
    method: 'put',
    data: data
  })
}

export function deleteWarehouse(id) {
  return request({
    url: '/wms/warehouse/' + id,
    method: 'delete'
  })
}

// 货位管理
export function listLocation(query) {
  return request({
    url: '/wms/location/list',
    method: 'get',
    params: query
  })
}

export function countLocation(params) {
  return request({
    url: '/wms/location/count',
    method: 'get',
    params
  })
}

export function getLocation(id) {
  return request({
    url: '/wms/location/' + id,
    method: 'get'
  })
}

export function addLocation(data) {
  return request({
    url: '/wms/location',
    method: 'post',
    data: data
  })
}

export function updateLocation(data) {
  return request({
    url: '/wms/location',
    method: 'put',
    data: data
  })
}

export function deleteLocation(id) {
  return request({
    url: '/wms/location/' + id,
    method: 'delete'
  })
}

// 物料管理
export function listMaterial(query) {
  return request({
    url: '/wms/material/list',
    method: 'get',
    params: query
  })
}

export function getMaterial(id) {
  return request({
    url: '/wms/material/' + id,
    method: 'put'
  })
}

export function addMaterial(data) {
  return request({
    url: '/wms/material',
    method: 'post',
    data: data
  })
}

export function updateMaterial(data) {
  return request({
    url: '/wms/material',
    method: 'put',
    data: data
  })
}

export function deleteMaterial(id) {
  return request({
    url: '/wms/material/' + id,
    method: 'delete'
  })
}

export function getMaterialByCode(code) {
  return request({
    url: '/wms/material/code/' + code,
    method: 'get'
  })
}

// 库存管理
export function listInventory(query) {
  return request({
    url: '/wms/inventory/list',
    method: 'get',
    params: query
  })
}

export function getInventory(id) {
  return request({
    url: '/wms/inventory/' + id,
    method: 'get'
  })
}

export function addInventory(data) {
  return request({
    url: '/wms/inventory',
    method: 'post',
    data: data
  })
}

export function updateInventory(data) {
  return request({
    url: '/wms/inventory',
    method: 'put',
    data: data
  })
}

export function deleteInventory(id) {
  return request({
    url: '/wms/inventory/' + id,
    method: 'delete'
  })
}

// 流程管理
export function listFlow(query) {
  return request({
    url: '/wms/flow/list',
    method: 'get',
    params: query
  })
}

// 预警管理
export function listWarning(query) {
  return request({
    url: '/wms/warning/list',
    method: 'get',
    params: query
  })
}

export function getWarning(id) {
  return request({
    url: '/wms/warning/' + id,
    method: 'get'
  })
}

export function addWarning(data) {
  return request({
    url: '/wms/warning',
    method: 'post',
    data: data
  })
}

export function updateWarning(data) {
  return request({
    url: '/wms/warning',
    method: 'put',
    data: data
  })
}

export function deleteWarning(id) {
  return request({
    url: '/wms/warning/' + id,
    method: 'delete'
  })
}

export function notifyWarning(id) {
  return request({
    url: '/wms/warning/notify/' + id,
    method: 'post'
  })
}